package com.neusoft.chenhanhua.ChineseChess;

public class Bing {
	public boolean bing(int x1,int y1,int x2,int y2, int i,int [] xs,int [] ys) {
		if (i<16) {
			if (y2>=6) {
				if ((y2==y1+1&&x2==x1) || (x2==x1+1&&y1==y2) || (x1==x2+1&&y1==y2)) {
					boolean wq=you(x1, y1, x2, y2, i, xs, ys);
					return wq;
				}
			} else {
                   if (y2==y1+1&&x2==x1) {
                	   boolean wq=you(x1, y1, x2, y2, i, xs, ys);
       				return wq;
				}
			}
		} else {
			if (y2<6) {
				if ((y1==y2+1&&x2==x1) || (x1==x2+1&&y1==y2) || (x2==x1+1&&y1==y2)) {
					boolean wq=you(x1, y1, x2, y2, i, xs, ys);
					return wq;
				}
			} else {
                   if (y1==y2+1&&x2==x1) {
                	   boolean wq=you(x1, y1, x2, y2, i, xs, ys);
       				return wq;
				}
			}

		}
		return false;
	}
	 public boolean you(int x1,int y1,int x2,int y2, int i,int [] xs,int [] ys) {
	    	for (int j = 0; j < ys.length; j++) {
	    		//判断有棋子就不能占
				if (x2==xs[j]&&y2==ys[j]) {
					return false;
				}
			}
	    	return true;
	     }
	
}

